﻿var status;
var text;
var taskid = 140001;
var package1 = 2430049; //新手礼物盒
var package1 = 2431092; //特殊超值礼包礼物箱
var waitMap = 310030210; // 等待地图
var changeJobMap = 910000000;   // 转职地图

var package1_list = new Array(
						Array(2431091, 100),
						Array(2431091, 100),
						Array(2431091, 100),
						Array(2431091, 100)
						);
var package2_list = new Array(
						Array(2431091, 100),
						Array(2431091, 100),
						Array(2431091, 100),
						Array(2431091, 100)
						);

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 0 && status == 0) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else {
            cm.dispose();
            return;
        }

        if (cm.getBossLog("新手向导") > 0) {
            cm.dispose();
            return;
        }

        if (status == 0 && cm.getBossLog("新手踩蜗牛副本") > 0) {
            status = 1;
        }

        if (status == 0) {
            var rank = cm.getRanking("潜能检测系统").iterator();
            text = "\t\t\t\t-未来之星潜能榜 -\r\n\r\n";
            text += "#d#n\r\n  排名		        玩家名称	        潜能值\r\n#k";
            var i = 1;
            while (rank.hasNext()) {
                var cid = rank.next();
                var light = cid.name == cm.getPlayer().getName();
                text += (light ? "#r" : "") + "\t" + i + "\t\t\t  " + (light ? "#k" : "");;

                text += (light ? "#r" : "") + cid.name + (light ? "#k" : "");
                for (var j = 18 - cid.name.getBytes().length; j > 0 ; j--) {
                    text += " ";
                }
                text += (light ? "#r" : "") + "\t " + cid.value + (light ? "#k" : "");;

                text += "\r\n";


                i++;
            }
            //cm.setBossLog("新手踩蜗牛副本", true);
            cm.sendNextS(text, 1);
        } else if (status == 1) {
            text = "恭喜你已经初步成为我们的一员，接下来 #e#r点击领取" + cm.getServerName() + "大礼包！！！#k#n\r\n\r\n";
         /*   for (var i = 0; i < 2; i++) {
                if (i != 1) {
                    text += "#L" + i + "##r#e领取" + cm.getServerName() + "大礼包#l#n\r\n";
                } else {
                    text += "#L" + i + "##b不接受挑战#l\r\n";
                }
            }*/
			text += "#L1##b开始冒险旅途#l\r\n";
            cm.sendSimpleS(text, 1);
        } else if (status == 2) {
			cm.gainItem(2430011, 1);//服务盒子
			cm.gainItem(2430686, 1);//服务盒子
            if (selection == 1) {
                cm.sendYesNo("那么是否准备前往自由市场呢？");
            }
        } else if (status == 3) {
            cm.warp(waitMap);
            cm.getPlayer().startMapTimeLimitTask(10, cm.getMap(changeJobMap));
            cm.dispose();
               cm.sendOk("背包中的[召唤管理员]可以了解关于本服更多的内容。");
        }
    }
}